--Gets all of the foreign keys within a table.

select
	col_name(fc.parent_object_id, fc.parent_column_id) as column_name,
	c.data_type,
	object_name (f.referenced_object_id) as primary_key_table,
	c.*
from sys.foreign_keys as f
inner join sys.foreign_key_columns as fc
	on f.object_id = fc.constraint_object_id
inner join information_schema.columns c
	on c.column_name = col_name(fc.parent_object_id, fc.parent_column_id)
	and c.table_name = object_name(f.parent_object_id)
where object_name(f.parent_object_id) = @table_name